using System;

using D3D = Microsoft.DirectX.Direct3D;
using Microsoft.DirectX.Direct3D;

namespace SharpWind.Resources.Creators
{
	public class BoxMeshCreator : IResourceCreator<Mesh>
	{
		private float width = 0f;
		
		private float height = 0f;
		
		private float depth = 0f;
	
		public BoxMeshCreator( float width, float height, float depth )
		{
			this.width  = width;
			this.height = height;
			this.depth  = depth;
		}

		public override string ToString()
		{
			return string.Format( "Width = {0}, Height = {1}, Depth = {2}",
								  this.width, this.height, this.depth );
		}

		public Mesh Create()
		{
			D3D.Mesh m = D3D.Mesh.Box( Engine.Instance.Renderer.Device, 
									   this.width, this.height, this.depth );

			Mesh mesh	 = new Mesh();
			mesh.D3DMesh = m.Clone( m.Options.Value, VertexFormats.Position, m.Device );
			
			return mesh;
		}
	}
}
